package com.itheima.protocol.disruptor;

import java.util.Map;

import com.lmax.disruptor.EventTranslatorOneArg;
import com.lmax.disruptor.RingBuffer;

public class UtranUuEventProducerWithTranslator {

    private static final EventTranslatorOneArg<UtranUuDisruptorEvent,UtranUuDisruptorEvent> TRANSLATOR = new EventTranslatorOneArg<UtranUuDisruptorEvent,UtranUuDisruptorEvent>() {

        @SuppressWarnings("unchecked")
        @Override
        public void translateTo(UtranUuDisruptorEvent event, long sequence, UtranUuDisruptorEvent UuExtendEvent) {
            
            event.setClearTime(UuExtendEvent.getClearTime());
            event.setCkearMapKey(UuExtendEvent.getCkearMapKey());
            event.setJobRunRemoveMap((Map<String, Object>) UuExtendEvent.getJobRunRemoveMap());
            
        }
    };
    private final RingBuffer<UtranUuDisruptorEvent> ringBuffer;

    public UtranUuEventProducerWithTranslator(RingBuffer<UtranUuDisruptorEvent> ringBuffer) {
        this.ringBuffer = ringBuffer;
    }


    public void onData(UtranUuDisruptorEvent event) {
        ringBuffer.publishEvent(TRANSLATOR, event);
    }
}
